<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="dao.NoteDao" import="java.util.*" import="model.NoteModel" %>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="author" content="李华胜<yehong0000@163.com>">
        <title>简易便签系统</title>
        <link rel="stylesheet" href="./Css/index.css" />
        <link rel="stylesheet" href="./Css/icon/style.css" />
        <script type="text/javascript" src='./Js/jquery-2.0.3.min.js'></script>
        <script type="text/javascript" src='./Js/msgBox.js'></script>
        <script type="text/javascript" src='./Js/main.js'></script>
        <script type="text/javascript" src='./Js/index.js'></script>
    </head>
<body>
    <div id="nav">
        <ul>
        <%if((Integer)session.getAttribute("id") == null){%>
            <li><a href="login.jsp" title="登录" class="icon-user-tie"></a></li>
            <%}else{ %>
             <li><a href="ucenter.jsp" title="<%=session.getAttribute("username") %>" ><img id="userhead" src="headerimage/<%=session.getAttribute("headerimage")%>"></a></li>
             <%} %>
            <!-- <li><a href="register.jsp" title="注册" class="icon-enter"></a></li> -->
            <li><a href="javascript:void();" id="send"  title="新建" class="icon-plus"></a></li>
        </ul>
    </div>
    <div id='main'>
    
    
    
<%
		request.setCharacterEncoding("utf-8");
		int p=1;
		NoteDao dao = new NoteDao();
		ArrayList<NoteModel> list = dao.selectShare(p);
		
		for(int i=0;i<list.size();i++){	
			String s = list.get(i).getTitle();
			String title;
			if(s.length()>80){
				title = s.substring(0,80)+"...";
			}else{
				title = s;
			}
%>
    <dl class='paper a<%=new java.util.Random().nextInt(5)+1%>'>
            <dt>
            <span class='title'><%=title%></span>
            <span class='num'><%=list.get(i).getId()%></span>
            </dt>
            <dd class='content' title="查看详细信息" href="detail.jsp?id=<%=list.get(i).getId()%>"><%=list.get(i).getContent()%></dd>
            <dd class='bottom'>
            <span class='time'><%=list.get(i).getDate()%></span>
            <a href="" class='close'></a>
            </dd>
        </dl>           
 <%} %>
        
        
        
    </div>

    <div id='send-form'>
        <p class='title'><span>添加便签</span><a href="" id='close'></a></p>
        <form action="" name='wish'>
            <p>
            <input type="text" placeholder="标题-（可选）" name='title' id='title'/>
            </p>
            <p>
            <textarea name="content" placeholder="内容" id='content'></textarea>
            <label for="content">(您还可以输入&nbsp;<span id='font-num'>50</span>&nbsp;个字)</label>
            </p>
            <span id="send-btn">保存</span>
        </form>
    </div>
    <div id="loading"><span>加载中...</span></div>
    <div id="footer">&copy;2015 "非常5+1"组实习结业设计</div>

    <!--[if IE 6]>
        <script type="text/javascript" src="./Js/iepng.js"></script>
        <script type="text/javascript">
            DD_belatedPNG.fix('#send,#close,.close','background');
        </script>
    <![endif]-->
</body>
</html>
